<?php
class ckBrowseAction extends rareAction{
	public function execute(){
		$funcNum = $this->getGetParam('CKEditorFuncNum',2);
		$CKEditor = $this->getGetParam('CKEditor','editor');
		$langCode = $this->getGetParam('langCode','zh-cn');

		define('DS', DIRECTORY_SEPARATOR);
		$path = $_SERVER['DOCUMENT_ROOT'].DS.'uploads'.DS.'ckeditor';
		$array = array();
		if(is_dir($path)){
			if($dh = opendir($path)){
				while(($file = readdir($dh)) !== false){
					if($file!='.'&&$file!='..'){
						$array[] = DS.'uploads'.DS.'ckeditor'.DS.$file;
					}
				}
			}
		}
		$this->assign('images',$array);
		$this->assign('funcNum',$funcNum);
		$this->assign('CKEditor',$CKEditor);
		$this->assign('langCode',$langCode);
		/*foreach($array as $url){
			echo "<img src='{$url}' width='100' height='100' />";
		}*/
		/*$funcNum = $_GET['CKEditorFuncNum'] ;
		$CKEditor = $_GET['CKEditor'] ;
		$langCode = $_GET['langCode'] ;
		 
		// Check the $_FILES array and save the file. Assign the correct path to a variable ($url).
		$url = '/path/to/uploaded/file.ext';
		// Usually you will only assign something here if the file could not be uploaded.
		$message = '';*/
		//echo "<script type='text/javascript'>window.parent.CKEDITOR.tools.callFunction($funcNum, '{$array[0]}', '$message');</script>";
		//exit;
	}
}
?>
